
<?php
namespace FacebookAction;

require_once( 'Facebook/FacebookSession.php' );
require_once( 'Facebook/FacebookRedirectLoginHelper.php' );
require_once( 'Facebook/FacebookRequest.php' );
require_once( 'Facebook/FacebookResponse.php' );
require_once( 'Facebook/FacebookSDKException.php' );
require_once( 'Facebook/FacebookRequestException.php' );
require_once( 'Facebook/FacebookAuthorizationException.php' );
require_once( 'Facebook/GraphObject.php' );
require_once( 'Facebook/GraphUser.php' );
require_once( 'Facebook/GraphSessionInfo.php' );

use Facebook\FacebookSession;
use Facebook\FacebookRedirectLoginHelper;
use Facebook\FacebookRequest;
use Facebook\FacebookResponse;
use Facebook\FacebookSDKException;
use Facebook\FacebookRequestException;
use Facebook\FacebookAuthorizationException;
use Facebook\GraphObject;
use Facebook\GraphUser;
use Facebook\GraphSessionInfo;

class FacebookLikes{
    public function getLikesObject($session, $objectId){
            $request = new FacebookRequest(
                $session, 'GET', '/' . $objectId . '/likes'
        );
        $response = $request->execute();
        $graphObject = $response->getGraphObject()->asArray();
        $my_json = json_encode((array) $graphObject);
        print_r($my_json);
        $return_json = json_decode($my_json, TRUE);
        return $return_json;
    }
}